home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / misc / qemtec.arj / BUS-MAST.TEC < prev    next >
Text File  |  1994-01-12  |  13KB  |  240 lines

  1. ID:BU QEMM:  Using Bus-Mastering Devices
  2. Quarterdeck Technical Note #121                       Filename: BUS-MAST.TEC
  3. by Quarterdeck Technical Support                    CompuServe: BUSMAS.TEC
  4. Last revised: 7/01/93                                 Category: HW
  5.  
  6. Subject: Bus-mastering devices and why they may require a Virtual DMA
  7.          Services (VDS) driver on 386 and higher machines in Virtual 8086
  8.          mode.  Owners of SCSI hard drives should read this note.
  9.  
  10. Note:  All references to 386 computers or to the 80386 processor, unless
  11.        otherwise stated, refer to 386 and higher processors.
  12.  
  13.  
  14.          BUS-MASTERING DEVICES, QEMM AND VIRTUAL DMA SERVICES
  15.  
  16. Q: What is a bus-mastering device and what problems might be seen when
  17.    using one?
  18.  
  19. Bus-mastering devices do their own direct memory addressing (DMA) without
  20. going through the machine's processor or its DMA controller. The most common
  21. bus-mastering devices we see currently are SCSI hard disk controllers, but
  22. other types of devices could be bus-mastering as well. We have seen
  23. bus-mastering ESDI disk controllers and an increasing number of bus-mastering
  24. network cards.  The problem seen with bus-mastering devices is that while they
  25. are high-performance devices and quite often found on 386 and higher systems,
  26. they are, unfortunately, by design incompatible with one of the most common
  27. operating modes of the 80386 processor--the Virtual 86 mode.
  28.  
  29. Specifically, the problem is that the device puts data into absolute memory 
  30. addresses and assumes that the contents of those memory addresses will always 
  31. remain constant.  However, on a 386 machine with the processor in Virtual 86 
  32. mode, this is often an incorrect assumption.  When QEMM provides High RAM, it
  33. typically associates PHYSICAL memory with unused LOGICAL addresses.  When a
  34. bus-mastering device refers to data, it presumes that physical and logical
  35. addresses are the same.  In Virtual 86 mode, the same logical memory addresses
  36. can, at any given moment, hold different data from various regions of physical
  37. memory, depending on which virtual machine is current.
  38.  
  39. If you are using a bus-mastering device on a 386 that is in Virtual 86 mode
  40. and memory paging is occurring (when QEMM is providing High RAM, when QEMM is
  41. providing expanded memory, or when the processor is switching from one virtual
  42. machine to another), your machine will probably hang when you use the
  43. bus-mastering device.
  44.  
  45. Quarterdeck first became aware of the problem from customers who had bus-
  46. mastering SCSI hard disk controllers.  Users reported that they could boot 
  47. their machines and start up DESQview, our multitasking software.  As long as
  48. they ran only one application, their system ran fine.  As soon as they opened
  49. a second application, the system would hang.  The problem was also seen by
  50. users who were not using DESQview, but who were using the LOADHI feature of
  51. QEMM.
  52.  
  53. In this case, the hang occurred because the disk controller would prepare to 
  54. load some absolute memory addresses with data pertaining to an application 
  55. that was running, but by the time the data was actually transferred to these 
  56. addresses, QEMM had switched the memory map.  Those absolute memory addresses
  57. no longer belonged to the application that could process the data. They
  58. belonged instead to some other application or process.  In theory, this could
  59. have caused data corruption, but in reality it never did.  The memory
  60. corruption was typically so extensive that the systems simply hung as soon as
  61. a change in the memory map occurred.  Other 386 memory managers exhibited the
  62. same symptoms.  The problem mentioned here is also a problem for Microsoft
  63. Windows version 3.x when run in Enhanced Mode.  Worse, since QEMM is almost
  64. completely disabled when you enter Enhanced Mode, any solutions to the problem
  65. that depend on QEMM's memory management may fail.
  66.  
  67. See the reference to SMARTDRV in item 4, below.
  68.  
  69. Q: How can the problem with running bus-mastering devices in Virtual 86 mode
  70.    be corrected?
  71.  
  72. There are four possible solutions:
  73.  
  74. 1)  THE BEST SOLUTION:  Contact the maker of your bus-mastering device and see 
  75. whether a driver is available which supports the VDS (Virtual DMA Services)
  76. specification.  VDS is now an industry-wide specification supported by IBM,
  77. Microsoft and Quarterdeck, as well as many other hardware and software
  78. suppliers.  A VDS driver allows a bus-mastering device to find the real
  79. physical address of its data when the processor is in Virtual 86 mode.
  80.  
  81. QEMM versions 5.00 and later support the VDS specification.  A VDS driver
  82. provides the best solution to this problem in terms of reliability, speed and
  83. memory efficiency.  A VDS driver may be loaded into High RAM if it appears in
  84. the CONFIG.SYS file after the QEMM386.SYS line; you may need a DB=2 parameter
  85. on the QEMM386.SYS line to accomplish this; see section 5 below.
  86.  
  87. 2) Similarly, the drivers of many bus-mastering hard disks have proprietary
  88. buffering options.  Check the documentation for your disk controller to see if
  89. the driver has a parameter to set up buffering for disk operations.  Some
  90. drivers will also document parameters that are specific to 386 operations. For
  91. example, the early Adaptec drivers SCSIHA.SYS and AHA1540.SYS included both
  92. 386 and disk buffering options invoked by the parameters "/v386" and "/b:64."
  93. "/v386" stands for virtual 386; "/b:64" allocates a 64k buffer, for DMA.
  94.  
  95. Unlike the drivers in (1) above, these drivers do not provide VDS services. If 
  96. you are using a driver such as this, make sure that it is not loaded high. The 
  97. purpose of such a driver is to provide buffering into physical addresses that 
  98. are the same as logical addresses; if the program is loaded high, its buffer 
  99. will be in logical addresses that are not the same as their physical
  100. addresses.  Please read the section below titled "Making Sure Your Device
  101. Driver Loads Low".
  102.  
  103. 3)  Check the documentation for your bus-mastering device and see if it can be 
  104. configured to use the BIOS or any one of the standard DMA channels.  QEMM can
  105. correct the problem if the BIOS or standard DMA channels are used.
  106.  
  107. 4)  As mentioned above, bus-mastering hard drives can also cause problems for 
  108. Microsoft Windows 3.  Microsoft's solution is in its SmartDrive disk cache. 
  109. SMARTDRV (and other disk caches) contain code that can buffer direct memory 
  110. access.  Since QEMM and its VDS services are almost completely disabled when
  111. you enter Enhanced mode, this is a good thing.  If you have a bus-mastering
  112. disk controller and wish to run Microsoft Windows in Enhanced mode while
  113. loading any programs high, you must use SmartDrive.
  114.  
  115. a) As of this writing, Microsoft Windows 3.1 provides you with a copy of
  116. SmartDrive v. 4.0 and DOS 6 ships with version 4.1.  These versions have two
  117. functions: to provide disk caching through a module loaded in AUTOEXEC.BAT,
  118. and to provide buffering for SCSI hard drives through a module loaded in
  119. CONFIG.SYS.  If you are using Windows 3.1 AND a bus-mastering hard drive and
  120. you are NOT using any of the options numbered 1 through 3 above, make sure
  121. that the following line appears in CONFIG.SYS:
  122.  
  123.    DEVICE=C:\WINDOWS\SMARTDRV.EXE /DOUBLE_BUFFER
  124.  
  125. (If your path to SmartDrive differs, change C:\WINDOWS to the correct path.)
  126.  
  127. Please read the section below titled "Making Sure Your Device Driver Loads
  128. Low".
  129.  
  130. b) Windows 3.0 and DOS 5 shipped with SmartDrive version 3 or lower.  If you
  131.    are using one of these versions of SmartDrive, make sure that the following
  132.    line appears in your CONFIG.SYS file:
  133.  
  134.    DEVICE=C:\WINDOWS\SMARTDRV.SYS
  135.  
  136. (If your path to SmartDrive differs, change C:\WINDOWS to the correct path.)
  137.  
  138. Please read the section below titled "Making Sure Your Device Driver Loads
  139. Low".
  140.  
  141. 5) QEMM versions 5.0 and later have a DB=xx (DISKBUF=xx) parameter that can
  142. prevent QEMM-SCSI problems at the expense of a little conventional memory.
  143. "xx" is the number of K used for buffering.  Any value for xx is sufficient to
  144. correct the problem.  DISKBUF=2 is fine for most cases. Configuring QEMM with
  145. a DISKBUF greater than 2 might improve disk performance, but setting DISKBUF
  146. to more than 10 is probably a waste of memory.
  147.  
  148. QEMM version 7 automatically creates a 2K disk buffer when it detects an
  149. addressing problem with a bus-mastering hard drive controller.  It will only
  150. do so, however, when QEMM itself is loaded from that bus-mastering hard drive.
  151. If you load a driver that provides VDS (Virtual DMA Services) support BEFORE
  152. you load QEMM, QEMM will not create the disk buffer.  In cases where QEMM
  153. automatically creates this buffer, it does not add a DISKBUF parameter to the
  154. QEMM386.SYS line.
  155.  
  156. QEMM's automatic detection of bus-mastering hard disks is active only when the
  157. RAM parameter is specified on the QEMM386.SYS line in the CONFIG.SYS file. You
  158. can disable QEMM's automatic disk buffering by using the QEMM386.SYS
  159. parameters DISKBUF=0, but there is usually no reason to disable this feature.
  160. If you have a bus-mastering hard disk that you do not load QEMM from, QEMM
  161. will not detect bus-mastering conflicts with it, and you must either use the
  162. disk controller's VDS support or specify the DISKBUF=nn.
  163.  
  164. Use of the DB= parameter will not help if the bus-mastering device is
  165. something other than a hard disk.  If your bus-mastering device is not a hard
  166. disk the solutions above, especially #1, are your only options.
  167.  
  168. If your bus-mastering hard disk controller uses a VDS device driver that is
  169. loaded after QEMM386.SYS, QEMM will still create a 2K disk buffer, because the
  170. VDS support will not be active when QEMM loads.  This disk buffer will be
  171. necessary in most circumstances, because the Optimize program would otherwise
  172. fail when it tried to load the VDS driver into High RAM. However, you may wish
  173. in this circumstance to reduce the size of the disk buffer as much as possible
  174. by placing the DISKBUF=1 parameter on the QEMM386.SYS device driver line.  The
  175. smaller disk buffer is preferable here, because the disk buffer will never
  176. again be used after the VDS driver loads, and a bigger disk buffer uses
  177. valuable conventional memory.
  178.  
  179. If you are both disabling automatic disk buffering (with the DISKBUF=0
  180. parameter) and creating a disk buffer for the page frame (with the
  181. DISKBUFFRAME=xx parameter), you must place the DISKBUF=0 parameter before the
  182. DISKBUFFRAME=xx parameter on the QEMM386.SYS line in the CONFIG.SYS file.  If
  183. you reverse this ordering, automatic disk buffering will still be disabled,
  184. but the disk buffer for the page frame will not be created.
  185.  
  186.  
  187. MAKING SURE YOUR DEVICE DRIVER LOADS LOW
  188.  
  189. Q. I've read the sections above.  I don't have a VDS driver, and I think that
  190.    my proprietary device driver or my disk cache should be loaded low.
  191.    How do I prevent it from loading high?
  192.  
  193. For double-buffering to work properly, the device driver for your bus-
  194. mastering hardware must be loaded in conventional memory, where physical and
  195. logical addresses are almost always the same.  You must therefore make sure 
  196. that it loads low if you are depending on it to provide DMA buffering. We will 
  197. use SMARTDRV as an example of such a program.  Change the instructions below
  198. to fit your device driver.
  199.  
  200. Ensure that there is no LOADHI command preceding SMARTDRV on the line which 
  201. loads it.
  202.  
  203. OPTIMIZE will very likely try to load SmartDrive high, unless you instruct it
  204. not to do so.  This is most easily done as follows:
  205.  
  206. 1) Using a text editor, create a text file called OPTIMIZE.EXC in the QEMM 
  207. directory.  Note that EXC (not EXE) is the extension on the file name.  If 
  208. such a file exists already, simply open it for editing.
  209.  
  210. 2) Put a line in OPTIMIZE.EXC that says:
  211.  
  212.    SMARTDRV
  213.  
  214.    Do not specify a pathname nor an extension to the file name.
  215.  
  216.  3) From now on, OPTIMIZE will not affect the SMARTDRV line in either
  217.     CONFIG.SYS or AUTOEXEC.BAT.  As long as SMARTDRV is not being loaded
  218.     high already, it will not load high.
  219.  
  220. FOR THOSE WHO HAVE BUS-MASTERING DEVICES AND NO PROBLEMS
  221.  
  222. Q:  I know I have a bus-mastering device on my computer, but I haven't seen 
  223.     any problem.  Why not?
  224.  
  225. It's possible that your bus-mastering device uses a standard DMA channel for 
  226. DMA operations.  QEMM can correct the problem when standard DMA channels
  227. are used.
  228.  
  229. Your bus-mastering device may have been shipped with a VDS driver.  Some
  230. bus-mastering hard disk controllers ship with drivers that make VDS calls,
  231. and these drivers do not require the DB parameter or any other buffering.  We
  232. expect that most bus-mastering devices will eventually include VDS drivers
  233. and, therefore, will not exhibit any problems when run in Virtual 86 mode.
  234.  
  235.   ************************************************************************
  236.   *This technical note may be copied and distributed freely as long as it*
  237.   *is distributed in its entirety and it is not distributed for profit.  *
  238.   *         Copyright (C) 1993 by Quarterdeck Office Systems             *
  239.   ************************ E N D   O F   F I L E *************************
  240.